package com.squo.ru.ebancky;

import android.content.Intent;
import android.os.Bundle;
//import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends FragmentActivity {
	SectionPagerAdapter mSectionPagerAdapter;
	ViewPager mViewPager;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mSectionPagerAdapter = new SectionPagerAdapter(getSupportFragmentManager());
		mViewPager = (ViewPager)findViewById(R.id.viewPager);
		mViewPager.setAdapter(mSectionPagerAdapter);
		PreferenceManager.setDefaultValues(this, R.xml.settings, false);
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(Menu.NONE,101,Menu.NONE,getString(R.string.main_activity_menu_item_settings));
		menu.add(Menu.NONE,100,Menu.NONE,getString(R.string.main_activity_menu_item_exit));		
		return true;
	}
	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item){
		switch (item.getItemId()) {
		case 100:
			finish();
			break;
		case 101:
			Intent intent = new Intent();
			intent.setClass(this, SettingsActivity.class);
			startActivity(intent);
			break;
		default:
			break;
		}
		return super.onMenuItemSelected(featureId, item);
	}
	@Override
	public void onResume(){
		super.onResume();
	}
}
